<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link th:href="@{/erp/assets/css/bootstrap.min.css}" rel="stylesheet" />
    <link rel="stylesheet" th:href="@{/erp/css/style.css}"/>
    <link th:href="@{/erp/assets/css/codemirror.css}" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/erp/assets/css/ace.min.css}" />
    <link rel="stylesheet" th:href="@{/erp/assets/css/font-awesome.min.css}" />
    <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all">
    <script th:src="@{/plugins/layui/layui.js}"></script>
    <title>Title</title>
</head>
<body>
<div style="margin-left: 100px">
<form class="layui-form">
        <div class="Operate_cont clearfix">
            <label class="form-label"><span class="c-red"></span>公司名称：</label>
            <div class="formControls ">
                <input type="text" class="input-text" lay-verify="required|cname"  lay-reqtext="公司名称不能为空" placeholder="" name="companyName">
            </div>
        </div>
        <div class="Operate_cont clearfix">
            <label class="form-label"><span class="c-red"></span>负责人：</label>
            <div class="formControls ">
                <input type="text" class="input-text" lay-verify="required|pname" lay-reqtext="负责人不能为空" placeholder="" name="principal">
            </div>
        </div>
        <div class="Operate_cont clearfix">
            <label class="form-label"><span class="c-red"></span>联系方式：</label>
            <div class="formControls ">
                <input type="text" class="input-text" lay-verify="required|phone" lay-reqtext="联系方式不能为空" placeholder="" name="telephone">
            </div>
        </div>
        <div class="Operate_cont clearfix">
            <label class="form-label"><span class="c-red"></span>运营区域：</label>
            <div class="formControls ">
                <input type="text" class="input-text" lay-verify="required|area" lay-reqtext="运营范围不能为空" placeholder="" name="operationArea">
            </div>
        </div>
        <div class="Operate_cont clearfix">
            <label class="form-label"><span class="c-red"></span>价格(元/每吨)：</label>
            <div class="formControls ">
                <input type="text" class="input-text" lay-verify="required|number" lay-reqtext="价格不能为空" placeholder="" name="price">
            </div>
        </div>
        <div class="Operate_cont clearfix">
            <label class="form-label">备注：</label>
            <div class="formControls">
                <textarea name="remarks" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" lay-verify="required" lay-reqtext="备注不能为空"></textarea>
            </div>
        </div>
    <div class="Operate_cont clearfix">
        <div class="formControls" style="margin-left: 200px">
            <button class="btn btn-primary radius" lay-submit lay-filter="formDemo">提交</button>&nbsp;<input value="重置" type="reset"  class="layui-btn layui-btn-primary"/>
        </div>
    </div>
</form>
</div>
</div>
</div>
<script>
    layui.use('form', function() {
        var form = layui.form;
        var $ = layui.jquery;
        form.verify({
            cname:[/^[\u4e00-\u9fa5]{4,8}$/,'请输入4-8个中文'],
            pname:[/^[\u4e00-\u9fa5]{2,4}$/,'请输入正确的负责人名称'],
            area:[/^[\u4e00-\u9fa5]{2,4}$/,'请输入2-4个中文'],
        })
        form.on('submit(formDemo)', function (data) {
            $.ajax({
                url: "/logistics/info_add",
                data: data.field,
                dataType: 'json',
                type: 'post',
                async: false,
                success: function (mydata) {
                    if (mydata == 1) {
                        parent.layui.table.reload("demo");
                        parent.layer.msg('添加成功', {icon: 1});
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    }
                }
            })
        })
    })
</script>
</body>
</html>